package top.mcwebsite.playandroid.business.search.impl.api

import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import top.mcwebsite.playandroid.business.articles.api.model.ArticleModel
import top.mcwebsite.playandroid.business.search.impl.model.HotSearchKey
import top.mcwebsite.playandroid.business.search.impl.model.SearchResultModel
import top.mcwebsite.playandroid.common.network.model.ApiResult
import top.mcwebsite.playandroid.common.network.model.PageModel
import top.mcwebsite.playandroid.common.network.model.RespModel

interface SearchApi {
    @POST("article/query/{page}/json")
    @FormUrlEncoded
    suspend fun search(
        @Path("page") page: Int,
        @Field("k") keyword: String
    ): ApiResult<RespModel<PageModel<SearchResultModel>>>

    @GET("hotkey/json")
    suspend fun hotSearchKey(): ApiResult<RespModel<List<HotSearchKey>>>
}